package com.android.pagemarket.business.model;

import org.json.JSONObject;

import com.android.pagemarket.io.protocol.out.InitInfo;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName="region")
public class Region
{
    @DatabaseField(id=true)
    public String rid;// 是 N 地域id
    @DatabaseField
    public String regionName;// 是 C 地域名称
    @DatabaseField(foreign=true,foreignAutoRefresh=true,columnName="init_id")
    public InitInfo initInfo;

    public static Region parse(JSONObject data, InitInfo initInfo) throws Exception
    {
        Region one = new Region();

        one.initInfo = initInfo;
        one.rid = data.getString("rid");
        one.regionName = data.getString("regionName");

        return one;
    }

    @Override
    public String toString()
    {
        return regionName;
    }
}